package com.example.springboot_demo.mappers;

import com.example.springboot_demo.pojo.Book;
import com.example.springboot_demo.pojo.Cart;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
//@Repository
public interface BookMapper {
    //获取所有图书
    List<Book> getAllBook();

    //根据id删除一种图书
    void deleteBook(@Param("bookId") int bookId);


    void dropNoColumn();


    void addNoColumn();

    //更新图书
    void updateBook(Book book);

    //增加一种类型的图书
    void addBook(Book book);

    //根据书籍id查询
    Book queryBookById(@Param("bookId") int bookId);

    //获取图书的总数量
    Integer getCount();

    Integer getStock(int bookId);

    //根据关键字查询图书数量
    Integer getCountByName(String Name);

    //分页查询
    List<Book> getBooksByPage(String queryName, int index, int pageSize);

    List<Book> getAllBooksByName(String queryName);

    void updateDataByCart(int bookId, int bookCnt);
}
